home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLSRC.PAK / OLEMDIFR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  3.4 KB  |  128 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1994, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.4  $
  6. //
  7. // Implementation of class TOleMDIFrame.
  8. //----------------------------------------------------------------------------
  9. #define INC_OLE2
  10. #include <owl/pch.h>
  11. #if !defined(OWL_DECMDIFR_H)
  12. # include <owl/decmdifr.h>
  13. #endif
  14. #if !defined(OWL_STATUSBA_H)
  15. # include <owl/statusba.h>
  16. #endif
  17. #if !defined(OWL_OCFEVENT_H)
  18. # include <owl/ocfevent.h>
  19. #endif
  20. #if !defined(OWL_OLEMDIFR_H)
  21. # include <owl/olemdifr.h>
  22. #endif
  23.  
  24. OWL_DIAGINFO;
  25. DIAG_DECLARE_GROUP(OwlOleMenu);
  26.  
  27. DEFINE_RESPONSE_TABLE2(TOleMDIFrame, TOleFrame, TMDIFrame)
  28.   EV_WM_ACTIVATEAPP,
  29.   EV_OC_APPINSMENUS,
  30. END_RESPONSE_TABLE;
  31.  
  32. //
  33. //
  34. //
  35. TOleMDIFrame::TOleMDIFrame(const char far* title,
  36.                            TResId          menuResId,
  37.                            TMDIClient&     clientWnd,
  38.                            bool            trackMenuSelection,
  39.                            TModule*        module)
  40. :
  41.   TOleFrame(title, &clientWnd, trackMenuSelection, module),
  42.   TMDIFrame(title, menuResId, clientWnd, module)
  43. //  ,TFrameWindow(0, title, &clientWnd, false, module),
  44. //  TWindow(0, title, module)
  45. {
  46. }
  47.  
  48. //
  49. //
  50. //
  51. TOleMDIFrame::~TOleMDIFrame()
  52. {
  53. }
  54.  
  55. //
  56. // Forward Activate messages to OcApp to allow it to notify any embedded servers
  57. // about being activated
  58. //
  59. void
  60. TOleMDIFrame::EvActivateApp(bool active, HTASK hTask)
  61. {
  62.   OcApp->EvActivate(active);
  63.   TMDIFrame::EvActivateApp(active, hTask);
  64. }
  65.  
  66. //
  67. // Insert our menus into a provided menu bar, possibly merging them with a
  68. // child and servers.
  69. //
  70. bool
  71. TOleMDIFrame::EvOcAppInsMenus(TOcMenuDescr far& sharedMenu)
  72. {
  73.   if (HOldMenu)
  74.     return true;
  75.  
  76.   // Recreate a temporary composite menu for frame and MDI child
  77.   //
  78.   TMenuDescr compMenuDesc; // empty menudescr
  79.   if (GetMenuDescr())
  80.     compMenuDesc.Merge(*GetMenuDescr());
  81.   const TMenuDescr* childMenu = GetClientWindow()->GetActiveMDIChild()->GetMenuDescr();
  82.   if (childMenu)
  83.     compMenuDesc.Merge(*childMenu);
  84.  
  85.   // Mask off the server menus
  86.   //
  87.   compMenuDesc.Merge(TMenuDescr(0,  0, -1, 0, -1, 0, -1));
  88.  
  89.   // Merge into the OLE shared menubar
  90.   //
  91.   TMenuDescr shMenuDescr(sharedMenu.HMenu,
  92.                          sharedMenu.Width[0],
  93.                          sharedMenu.Width[1],
  94.                          sharedMenu.Width[2],
  95.                          sharedMenu.Width[3],
  96.                          sharedMenu.Width[4],
  97.                          sharedMenu.Width[5]);
  98.   shMenuDescr.Merge(compMenuDesc);
  99.  
  100.   // Copy the shared menu widths back to the OC struct
  101.   //
  102.   for (int i = 0; i < 6; i++)
  103.     sharedMenu.Width[i] = shMenuDescr.GetGroupCount(i);
  104.  
  105.   // Save the container popups so they can be destroyed later
  106.   //
  107.   StashContainerPopups(shMenuDescr);
  108.  
  109.   TRACEX(OwlOleMenu, 0, "MDI merged menu " << hex << (uint)sharedMenu.HMenu);
  110.   return true;
  111. }
  112.  
  113. //
  114. //
  115. //
  116. TResult
  117. TOleMDIFrame::DefWindowProc(uint message, TParam1 param1, TParam2 param2)
  118. {
  119.   //
  120.   // ::DefFrameProc() will response to WM_SIZE by making the MDI client the
  121.   // same size as the client rectangle; this conflicts with what TLayoutWindow
  122.   // has done
  123.   //
  124.   return message == WM_SIZE ?
  125.                       0 :
  126.                       TMDIFrame::DefWindowProc(message, param1, param2);
  127. }
  128.